<?php
include_once "xAP-functions/webincludes.php";



$now=date("Y-m-d H:i:s");
$ref=explode(",",$_GET["id"]);
	if(is_array($ref)){
		
		$channellist=" and (xAP_TV_Channel.ChannelID=".implode(" or xAP_TV_Channel.ChannelID=",$ref).")";
	
	}


$sql="select xAP_TV_Prog.ChannelName,xAP_TV_Prog.ProgName,xAP_TV_Prog.ProgStart,xAP_TV_Prog.ProgEnd,
xAP_TV_Channel.ChannelAlias ,xAP_TV_Prog.ProgDesc,xAP_TV_Channel.ChannelID,
xAP_TV_Prog.ProgID
from xAP_TV_Prog 
INNER JOIN xAP_TV_Channel on xAP_TV_Channel.ChannelName=xAP_TV_Prog.ChannelName

where xAP_TV_Prog.ProgStart<='".$now."' and xAP_TV_Prog.ProgEnd>='".$now."'
".$channellist."

order by xAP_TV_Channel.ChannelOrder
";
$results=dbquery($sql);


//display
$body="<table class='widget' cellpadding=0 cellspacing=0>";
foreach($results as $row){
$body.= "<tr>
<TD width=33><a href='/".$config["modulefolder"]."/channel.php?id=".$row["ChannelID"]."'>
<img src='/".$config["modulefolder"]."/images/channels/".$row["ChannelName"].".jpg' height=25 width=33></a></td>
<TD>&nbsp;</TD>
<TD class='normaltext'>".$row["ProgName"]."</td>
</tr>
";

}
$body.="</table>";


echo $body;
?>